package com.shengqin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shengqin.common.pojo.CommonPage;
import com.shengqin.common.pojo.CommonResult;
import com.shengqin.entity.SummaryArchive;
import com.shengqin.entity.SummaryGraduation;
import com.shengqin.pojo.summary.DocParam;
import com.shengqin.pojo.summary.GraduationQueryParam;
import com.shengqin.service.ISummaryArchiveService;
import com.shengqin.service.ISummaryGraduationService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("admin/v1/summary/history")
public class SummaryArchiveController {
    @Resource
    private ISummaryArchiveService summaryResultHisService;
    @Resource
    private ISummaryGraduationService summaryGraduationService;
    @PostMapping("page")
    public CommonResult<Page<SummaryArchive>> getPage(@RequestBody CommonPage<SummaryArchive> pageParam) {
        return CommonResult.data(summaryResultHisService.getPage(pageParam));
    }
    @PostMapping("calculate")
    public CommonResult<Boolean> calculateGraduation(@RequestBody DocParam docParam){
        return CommonResult.data(summaryResultHisService.calculateGraduation(docParam.getSchoolYear()));
    }
    @PostMapping("graduation")
    public CommonResult<Page<SummaryGraduation>> getGraduation(@RequestBody CommonPage<GraduationQueryParam> pageParam){
        return CommonResult.data(summaryGraduationService.getPage(pageParam));
    }
}